UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OPTA2r3JuDxhe1KF0INCIhB5msaiRxJ6QWBSCvRWYZ0='
WHERE
key_id = '6d45b87eccaf01654b451426ea3f77ab6aaa2c20aac621aeb9804acb44ce126c'
AND (
token = 'OPTA2r3JuDxhe1KF0INCIhB5msaiRxJ6QWBSCvRWYZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)