UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iS/cRpDbYtBMbYKNL3rRQKxZngQ6d3oa+sfl1nizghc=' 
WHERE 
  key_id = '3c100fb99167830a09363cc3969865575f26b8f4fc2ed4d2fd6feb337f2b8ff8' 
  AND (
    token = 'iS/cRpDbYtBMbYKNL3rRQKxZngQ6d3oa+sfl1nizghc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041