UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6PpTFMpU0BB90dIfDN9uTjxvDd2V75lkFEQ8x19nAQU=' 
WHERE 
  key_id = 'f8afcb02e2febd483dc558d263fff148b7362e7ffd4c68081c697c149b2a258c' 
  AND (
    token = '6PpTFMpU0BB90dIfDN9uTjxvDd2V75lkFEQ8x19nAQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032