UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dQj1ka8TcTCLxpaKiOFdgHRHjrtU2MfaWC91bqNbPAw='
WHERE
key_id = '500c7f39485c5a6e22879aeb2c86adc0045b4d916748be49efba8b070d8b9f77'
AND (
token = 'dQj1ka8TcTCLxpaKiOFdgHRHjrtU2MfaWC91bqNbPAw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)