UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vuC/+JkZ3ri5fJkLCShIEZ+i02Tsv1QuRhe+GHmYOdo=' 
WHERE 
  key_id = '4d3172237542b30b85782de15a8746f8c4fa0a1d7a60965baeb78494f643a464' 
  AND (
    token = 'vuC/+JkZ3ri5fJkLCShIEZ+i02Tsv1QuRhe+GHmYOdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038