UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l4Vj1owO5e39Vra4fQn7pWstXPezFIgG4eh+F6d8I+A=' 
WHERE 
  key_id = '0da50e38308454401b1c21f3c833c1322bac35acda446da2379ab15eece1ab77' 
  AND (
    token = 'l4Vj1owO5e39Vra4fQn7pWstXPezFIgG4eh+F6d8I+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030