UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0wgH3cNKP/d+geRj1S9oYBi/fyt16PFmBdqy9L6waj8='
WHERE
key_id = 'd603027ecfaaa73fde63f60a1c771302223981c0686a847368018d8cf7827f6b'
AND (
token = '0wgH3cNKP/d+geRj1S9oYBi/fyt16PFmBdqy9L6waj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)