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