UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pxuuUWz4segOGai0OF0xrpHyHH6pZCpYuOamvuju7Ds='
WHERE
key_id = '42ba2e6adb5f9987e32830c0e2db783c47719bb5ed40ed397b92a34b3cdc3576'
AND (
token = 'pxuuUWz4segOGai0OF0xrpHyHH6pZCpYuOamvuju7Ds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)