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