UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bp5UPIm+TeVP+6y5LQK5YYcItOWg3AhrLxXOzjwbixs='
WHERE
key_id = '1d1cf7b30611c8a983fe4f6b9dbad207f72ba8c445df1fc9e0d5e9e8d839c40b'
AND (
token = 'bp5UPIm+TeVP+6y5LQK5YYcItOWg3AhrLxXOzjwbixs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)