UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lsqooBC1Ruo4Z+b8uWt13GFkWMN4z4BGIvtjQlU+4Ek=' 
WHERE 
  key_id = '6223f578129e5e4887f1a90226a331a438e8d043f3b339817259e00df1c0ada8' 
  AND (
    token = 'lsqooBC1Ruo4Z+b8uWt13GFkWMN4z4BGIvtjQlU+4Ek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030