UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x45NGiHTpQRrUSLstgwjPlbGQapXJT3i4GDV+hIin/k='
WHERE
key_id = 'aa3e5296976796892e1a4340df90d9c195c0ae5deabbc2031f32a4db3bb60969'
AND (
token = 'x45NGiHTpQRrUSLstgwjPlbGQapXJT3i4GDV+hIin/k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)