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