UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'diwQTBVq1VsGltEio6aiUAWYRPY1ke4f89uM8SD7LS4='
WHERE
key_id = '7fd4ad9a148b082d92da627f229f8da8326449d5fb45be9e1dfc03217b741873'
AND (
token = 'diwQTBVq1VsGltEio6aiUAWYRPY1ke4f89uM8SD7LS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)