UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'treVlDFYsRJzL1IfcjPjcI0fQLT4y+49k77SfZ99Ilg=' 
WHERE 
  key_id = '02e7641b9b0d3404c3216a4d06f3d35e5ed3b68f71a16fe7dbb3939942087451' 
  AND (
    token = 'treVlDFYsRJzL1IfcjPjcI0fQLT4y+49k77SfZ99Ilg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030