UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AFR14x1XriFSq74f0yM+32JfFphu31SqVAPZfgJiCaM=' 
WHERE 
  key_id = 'b124e4dffb47a26911fc28616a2cded5978da836a7362514358e52ed46c9194e' 
  AND (
    token = 'AFR14x1XriFSq74f0yM+32JfFphu31SqVAPZfgJiCaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034