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