UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ib1ibefPU4VtIqYqfP9jJai67J6X64jNtxSoNNIUbXI='
WHERE
key_id = 'a95132887940ea0053b75f269cd22381546b94ac46222a1009e176d0548d5d0a'
AND (
token = 'ib1ibefPU4VtIqYqfP9jJai67J6X64jNtxSoNNIUbXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)