UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gvYDFENtWCKv3YTtznaGkQMYN9YczobBML+igBfRjB8=' 
WHERE 
  key_id = '949d06d7a498c165c4057c95236afa6709471ef2e019915052023a9f65d453d7' 
  AND (
    token = 'gvYDFENtWCKv3YTtznaGkQMYN9YczobBML+igBfRjB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044