UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7P+vK2CCKKmicW/yYoiSAa2m/n8xBwUTnpJbh/Z+DlY=' 
WHERE 
  key_id = 'b4fbfb4ae9d0def42edd6a7af3e6093dad9109b5c7fb680d6b10905746d6bdd5' 
  AND (
    token = '7P+vK2CCKKmicW/yYoiSAa2m/n8xBwUTnpJbh/Z+DlY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029