UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'exk9oldgF3h89tVNfmJxnqUl+Zus+zStAzZ7aCc3Nno='
WHERE
key_id = '5f84215655bbf25e5782bd4112842d13b2b801cb33ad808dcb8826768772699a'
AND (
token = 'exk9oldgF3h89tVNfmJxnqUl+Zus+zStAzZ7aCc3Nno='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)