UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F40wATrxC7+NzT+6snWbLP6gVh4rGNT40NNcVD9b6FQ=' 
WHERE 
  key_id = 'ec2f7d6955a99478c9c2f09929e6607169af5f9de166a2b2e069ef4551035816' 
  AND (
    token = 'F40wATrxC7+NzT+6snWbLP6gVh4rGNT40NNcVD9b6FQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033