UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JIm5+jHLftHGaiCUoyTnGKCNKVTK1Qk8O7v7p4uVKMY='
WHERE
key_id = '93b5d91b08b28872840c6c47b251f9648e1a81d74f1703b1606798670a9adecc'
AND (
token = 'JIm5+jHLftHGaiCUoyTnGKCNKVTK1Qk8O7v7p4uVKMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)