UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K78i0xZJhUD4BrDEOHzCmb/RmJ31s8AkW7Cm8lrxdFY='
WHERE
key_id = 'd4fce731e1df2c5219f0eafb90716846cd74ab8b7a521396cc4951580f977254'
AND (
token = 'K78i0xZJhUD4BrDEOHzCmb/RmJ31s8AkW7Cm8lrxdFY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)