UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bp/HsM99OzLq8exr3EFq1Av/+aUdgW5nJz6ds1P0ut4='
WHERE
key_id = 'c9d99d77272decde7edc588d7b1669b59f487c6a980cbd61ebd61ce4c4aab1f9'
AND (
token = 'bp/HsM99OzLq8exr3EFq1Av/+aUdgW5nJz6ds1P0ut4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)