UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iwz63+f3eN58DW3Oi7TlnkuErmTnw2OvkD5+QhfYfWY=' 
WHERE 
  key_id = 'b1c799c9ffc9baddbfeabb1e024a3e3e283f8097d2cdf2572ea32ebc58325375' 
  AND (
    token = 'iwz63+f3eN58DW3Oi7TlnkuErmTnw2OvkD5+QhfYfWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030