UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zn0ncfg2WNRJo6UFbLHTfIAAc3bMAIxdFTtiTq54Xh4=' 
WHERE 
  key_id = '4f0bbcde1c223c06831870c37a2be9c176d197cdb27897b3c6a82edc3b5219dc' 
  AND (
    token = 'zn0ncfg2WNRJo6UFbLHTfIAAc3bMAIxdFTtiTq54Xh4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039