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