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