UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kmyv0CKyh8Uv/z7GLBZ912s4ATcRrwZGlCMSJU+p7W8='
WHERE
key_id = 'e11efad17c8adf0d3dd0270b96165df4eb128761e584ddf3f039ef7bf88f27a3'
AND (
token = 'Kmyv0CKyh8Uv/z7GLBZ912s4ATcRrwZGlCMSJU+p7W8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)