UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cBymoO4EPnMkQnMCeEQuspaIPrZP+J2LYDqDThpj3Lc='
WHERE
key_id = 'f58def785b68fc666d06191be5f9ade3d70633190a8d0f8674bd8b2477b82578'
AND (
token = 'cBymoO4EPnMkQnMCeEQuspaIPrZP+J2LYDqDThpj3Lc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)