UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/U/nnWrQlp7jol/c+6Jiy5j8BYzyojscynljkCTphqI=' 
WHERE 
  key_id = '38e2c5761653a4bb109190f9c6ddaebf6604cae19b28d89e262684d0f6790642' 
  AND (
    token = '/U/nnWrQlp7jol/c+6Jiy5j8BYzyojscynljkCTphqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036