UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4P9HcRyPR+3EfCVHJaPms8pRwYSc+KeoYWQsmzG+epA=' 
WHERE 
  key_id = 'a3013640e18e26acf596617cfefaf2cb10247f8dcfce2807e1bad0ddd9f35a8f' 
  AND (
    token = '4P9HcRyPR+3EfCVHJaPms8pRwYSc+KeoYWQsmzG+epA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016