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