UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N62eVAVdlGbbfX5Y63EmJeL65y5pNoK2l3ss0nEXLB4=' 
WHERE 
  key_id = '7001d302aed93514a4919060e359e1d2dacf49a5b05683e477bc91367ad70442' 
  AND (
    token = 'N62eVAVdlGbbfX5Y63EmJeL65y5pNoK2l3ss0nEXLB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057