UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Zrez+P0H61XadX7uSS9xsum/MFDP2q03ab6X0uFd+E='
WHERE
key_id = 'e4f74d7d51a491bc895c0ebaff468120d2627dd4cb14850578909f9960b52a8a'
AND (
token = '9Zrez+P0H61XadX7uSS9xsum/MFDP2q03ab6X0uFd+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)