UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x/BI+m8dMVKeQsi3WcVxugVvucbyCHZBznNQIUIPQHk='
WHERE
key_id = '002dff1fd986d3eb24903f849676df41d9c5f0eaeafd2bec6482b2e95e566ea8'
AND (
token = 'x/BI+m8dMVKeQsi3WcVxugVvucbyCHZBznNQIUIPQHk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)