UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TasFQrOfXxDOBibxhyrNSdOFw734KW+QU+BD+5tSHn8='
WHERE
key_id = '66893d7fba94c7a18a62d865013d10d407effacf585cf976e790f11bb4b0b0f6'
AND (
token = 'TasFQrOfXxDOBibxhyrNSdOFw734KW+QU+BD+5tSHn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)